<!DOCTYPE html>
<html lang='en'>

<head>
    <mate charset='UTF-8' name='viewport' content='width=device-width,initial-scale=1.0'>
        <title>closure</title>
</head>

<body>
    <script>
        // getSalary(12000,2000);
        // getSalary(15000,3000);
        // getSalary(15000,4000);
        //不同级别的员工求工资(基本工资+绩效工资)
        function makeSalary(base) {
            return function (performance) {
                return base + performance;
            }
        }

        var salaryLevel1 = makeSalary(12000);
        var salaryLevel2 = makeSalary(15000);

        console.log(salaryLevel1(2000));
        console.log(salaryLevel2(3000));
        console.log(salaryLevel2(4000));

    </script>
</body>

</html>